At present, with the development of Internet technologies, a network has gradually become an important source for people to obtain information. Especially, after the Internet enters the Web2.0 era, users are both browsers of website content and makers of website content. Content created with involvement of a user is referred to as user generated content (UGC), such as a journal and photo released by the user. In the Web2.0 era, due to emergence of large amounts of UGC, the amount of network information grows exponentially.
At present, one of the most active network communications systems is a social network service (SNS) system. The SNS is briefly referred to as a social network system, which is an Internet application service system that aims to help people to build a social network. At present, almost all website systems are expanding social convenience thereof, to add an SNS feature to the website systems. In this specification, all website systems having an SNS feature, for example, an online community system, a blog system, and a microblog system (briefly referred to as microblog), are collectively referred to as a social network system.
In the SNS, each user releases information, and a large amount of UGC is generated almost at every moment. Besides, each user has a respective relation chain. A relation chain of a user mainly includes a user group that can interact with the user in the SNS. User relation chain data includes information such as an identifier and attribute of each user in the group, and a relation between each user and the primary user. The relation chains of some users have a huge amount of users. Such a relation chain is referred to as a long relation chain in the industry, and a user having a long relation chain is referred to as a long relation chain user.
For example, microblog is an SNS system of information sharing, distribution and obtaining based on a user relation. A user can access the microblog by using a wired communications network or a wireless communications network, and various clients, update information by using a specified number of words and/or other multimedia information, and implement instant sharing. In the microblog system, each user can listen to (or follow) another user, that is, microblog information (that is, UGC) released by a user that is listened to (or followed) by the user can be transmitted to microblog of the user in time. A user listening is an “audience” (which is also referred to as a “fan” in some microblog systems, the audience is used as an example for description in this specification) of a user that is listened to. Certainly, all users can also be listened to (or followed) by other users. When the number of audiences of a user exceeds a certain number, the user becomes a long relation chain user, for example, some star users in microblog generally have millions or even tens of millions audiences.
In an SNS in which UGC is generated, because data is generated by users, a mass number of users lead to a mass amount of data, and finally cause a great deal of data read and write requests. Especially for data processing of a long relation chain user, because a long relation chain of the user includes millions or even tens of millions of audiences, when an audience is added or deleted, data modification needs to be performed on a long relation chain of a user that is listened to; therefore, the number of requests for long relation chain data is huge, which are triggered frequently, and consequently, the number of operations on a corresponding database (DB) is also huge and the operations are performed frequently. Therefore, the long relation chain data of the user needs special processing.
FIG. 1 is a system for processing long relation chain user data in the existing technology. Referring to FIG. 1, the system mainly includes a cache module and a saving module. A DB stores full long relation chain data of a long relation chain user, for example, a full audience list in a microblog system. However, because the long relation chain user does not need the full audience list when reading microblog, in order to respond to a read request for an audience list from this type of long relation chain user at a font end at top speed, a part of an audience list of each long relation chain user is saved in the cache module of memory according to update time. The cache module is configured to respond to operation requests, from a front end (that is, a user operation end, such as a client or a webpage front end), for long relation chain data of the long relation chain user. Because operation of the memory is quick, the read request for the relation chain data of the long relation chain user may be responded to at top speed. For write operation requests, that is, modification requests for performing saving modification on corresponding DBs, the modification requests need to be synchronized to the saving module, and the saving module modifies data in the DBs according to the modification requests.
However, the foregoing existing technology has the following defects:
The cache module performs a pure memory operation, the saving module performs an operation on an underlying DB directly, and a speed of the DB operation and a speed of the pure memory operation are not on the same order of magnitude, which are greatly differed. In order to solve the problem that the speed of the cache module and the speed of the saving module are inconsistent, the cache module needs to store an operation log of a long relation chain user for a long time, and can release space occupied by the operation log only when the saving module completes the DB operation. Therefore, in the existing technology, saving and storage of long relation chain data of a user seriously relies on the cache module, where not only a large amount of memory space of the cache module is occupied, but also once the cache module restarts abnormally, the memory is cleared, and thus a large number of modification requests are lost, leading to serious inconsistency between long relation chain data in a DB and a front-end operation, and a high data error rate.